package Two;

import java.util.Iterator;
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Comparator;

public class Two {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		TreeSet<String> set = new TreeSet<String>();
		while (scan.hasNext()) {
			String s = scan.next();
			if (s.equals("!!!!!")) {
				break;
			} else {
				set.add(s);
			}
		}
		System.out.println(set.size());
		@SuppressWarnings("rawtypes")
		Iterator it = set.iterator();
		int t = 0;
		while (it.hasNext() && t < 10) {
			t++;
			System.out.println(it.next());
		}
		scan.close();
	}   

}
